import * as actions from './actions'
import * as getters from './getters'
import mutations from './mutations'



const state = {
	isLogged: cookie().status('user'),
	user: cookie().get('user'),
	name: {
		type: '',
		content: '',
	},
}

if(cookie().status('user')) {
	let user = cookie().get('user');
	if(user.customerInfo.nickname) {
		state.name.content = user.customerInfo.nickname
		state.name.type = 'nickname'
	} else if(user.customerInfo.userName) {
		state.name.content = user.customerInfo.userName
		state.name.type = 'userName'
	} else if(user.customerInfo.mobile) {
		state.name.content = user.customerInfo.mobile
		state.name.type = 'mobile'
	} else if(user.customerInfo.email) {
		state.name.content = user.customerInfo.email
		state.name.type = 'email'
	}
}

console.log(cookie().status('user'))

export default {
	state,
	actions,
	getters,
	mutations
}